package com.controller.setting;



import com.comm.R;
import com.comm.vo.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;



@RequestMapping("/sys_emp")
@RestController
@Api(value = "员工数据test",tags = "员工数据信息接口API")
public class SysEmployeeController {

    //分页查询所有员工信息
    @RequestMapping(value = ("/findEmpList"),method = RequestMethod.GET)
    @ApiOperation(value = "分页显示所有员工接口",notes = "分页查询所有员工信息",httpMethod = "get", response = JsonResult.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage",value = "当前页码",paramType = "query",dataType = "int",required = true),
            @ApiImplicitParam(name = "pageSize",value = "每页显示条数",paramType = "query",dataType = "int",required = true)
    })
    public JsonResult findEmpList(@RequestParam(name = "currentPage")Integer currentPage,
                                  @RequestParam(name = "pageSize")Integer pageSize){
        JsonResult jsonResult = new JsonResult();
        jsonResult.setCode(200);
        jsonResult.setMsg("查询成功");
        String data = " [{\n" +
                "   \"id\": 1,\n" +
                "   \"empName\": \"杜鑫东\",\n" +
                "   \"empSex\": \"男\",\n" +
                "   \"empAge\": 22,\n" +
                "   \"empPhoneNum\": \"14584212148\",\n" +
                "   \"officeId\":2,\n" +
                "   \"menuId\":4,\n" +
                "   \"jionTime\":\"2023-02-15 22:39:18\",\n" +
                "   \"office\": {\n" +
                "  \t  \"officeId\":2,\n" +
                "  \t  \"officeName\",\"腔肠科\",\n" +
                "    \t  \"officeNumber\":\"2023021500000001\",\n" +
                "   \t  \"status\":1},\n" +
                "   \"menu\":{\n" +
                "\t  \"menuId\":4,\n" +
                "       \"menuName\":\"医生\"}\n" +
                "   },\n" +
                "   {\n" +
                "   \"id\": 2,\n" +
                "   \"empName\": \"胡勇\",\n" +
                "   \"empSex\": \"男\",\n" +
                "   \"empAge\": 30,\n" +
                "   \"empPhoneNum\": \"18328135844\",\n" +
                "   \"officeId\":3,\n" +
                "   \"menuId\":4,\n" +
                "   \"jionTime\":\"2023-02-15 22:39:18\",\n" +
                "   \"office\": {\n" +
                "  \t  \"officeId\":3,\n" +
                "  \t  \"officeName\",\"妇科\",\n" +
                "    \t  \"officeNumber\":\"2023021500000001\",\n" +
                "   \t  \"status\":1},\n" +
                "   \"menu\":{\n" +
                "\t  \"menuId\":4,\n" +
                "       \"menuName\":\"医生\"}\n" +
                "   }  ]";
        jsonResult.setData(data);
        jsonResult.setCount(10);
        return jsonResult;
    }

    //根据姓名查询员工信息
    @RequestMapping(value = ("/findEmpByName"),method = RequestMethod.GET)
    @ApiOperation(value = "条件查询员工信息接口",notes = "根据姓名查询员工信息",httpMethod = "get", response = R.class)
    @ApiImplicitParam(name = "emp_name",value = "用户名",required = true,dataType = "String",paramType = "query")
    public R findEmpByName(@RequestParam(name = "emp_name")String emp_name){
        R r = new R();
        r.setCode(200);
        r.setMsg("查询成功");
        String data = " [{\n" +
                "   \"id\": 1,\n" +
                "   \"empName\": \"杜鑫东\",\n" +
                "   \"empSex\": \"男\",\n" +
                "   \"empAge\": 22,\n" +
                "   \"empPhoneNum\": \"14584212148\",\n" +
                "   \"officeId\":2,\n" +
                "   \"menuId\":4,\n" +
                "   \"jionTime\":\"2023-02-15 22:39:18\",\n" +
                "   \"office\": {\n" +
                "  \t  \"officeId\":2,\n" +
                "  \t  \"officeName\",\"腔肠科\",\n" +
                "    \t  \"officeNumber\":\"2023021500000001\",\n" +
                "   \t  \"status\":1},\n" +
                "   \"menu\":{\n" +
                "\t  \"menuId\":4,\n" +
                "       \"menuName\":\"医生\"}\n" +
                "   },\n" +
                "   {\n" +
                "   \"id\": 2,\n" +
                "   \"empName\": \"胡勇\",\n" +
                "   \"empSex\": \"男\",\n" +
                "   \"empAge\": 30,\n" +
                "   \"empPhoneNum\": \"18328135844\",\n" +
                "   \"officeId\":3,\n" +
                "   \"menuId\":4,\n" +
                "   \"jionTime\":\"2023-02-15 22:39:18\",\n" +
                "   \"office\": {\n" +
                "  \t  \"officeId\":3,\n" +
                "  \t  \"officeName\",\"妇科\",\n" +
                "    \t  \"officeNumber\":\"2023021500000001\",\n" +
                "   \t  \"status\":1},\n" +
                "   \"menu\":{\n" +
                "\t  \"menuId\":4,\n" +
                "       \"menuName\":\"医生\"}\n" +
                "   }  ]";
        r.setData(data);
        return r;
    }


    //已禁用人数按钮
    @RequestMapping(value = ("/findEmpStopNum"),method = RequestMethod.POST)
    @ApiOperation(value = "显示已禁用员工信息接口",notes = "显示已禁用人数，点击查看已禁用人员信息(分页显示)",httpMethod = "post", response = JsonResult.class)
    public JsonResult findEmpStopNum(){

        JsonResult jsonResult = new JsonResult();

        jsonResult.setCode(200);
        jsonResult.setMsg("查询成功");
        jsonResult.setCount(20);
        String data = " [{\n" +
                "   \"id\": 1,\n" +
                "   \"empName\": \"哈哈哈\",\n" +
                "   \"empSex\": \"男\",\n" +
                "   \"empAge\": 22,\n" +
                "   \"empPhoneNum\": \"18990722417\",\n" +
                "   \"officeId\":2,\n" +
                "   \"menuId\":4,\n" +
                "   \"jionTime\":\"2023-02-15 22:39:18\",\n" +
                "   \"office\": {\n" +
                "  \t  \"officeId\":5,\n" +
                "  \t  \"officeName\":\"牙科\",\n" +
                "    \t  \"officeNumber\":\"2017112900000002\",\n" +
                "   \t  \"status\":1},\n" +
                "   \"menu\":{\n" +
                "\t  \"menuId\":4,\n" +
                "       \"menuName\":\"医生\"}\n" +
                "  }]";
        jsonResult.setData(data);

        return jsonResult;
    }

    @RequestMapping(value = ("/addEmp"),method = RequestMethod.POST)
    @ApiOperation(value = "添加员工接口",notes = "添加员工信息",httpMethod = "post", response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "emp_name",value = "员工姓名",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "office_id",value = "所在科室id",paramType = "query",dataType = "int",required = true),
            @ApiImplicitParam(name = "emp_grade",value = "员工级别",paramType = "query",dataType = "int",required = true),
            @ApiImplicitParam(name = "emp_phone_num",value = "手机号",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "emp_age",value = "年   龄",paramType = "query",dataType = "int",required = true),
            @ApiImplicitParam(name = "id",value = "角色id",paramType = "query",dataType = "int",required = true)
    })
    public R addEmp(@RequestParam(name = "emp_name")String emp_name,
                    @RequestParam(name = "office_id")Integer office_id,
                    @RequestParam(name = "emp_grade")Integer emp_grade,
                    @RequestParam(name = "emp_phone_num")String emp_phone_num,
                    @RequestParam(name = "emp_age")Integer emp_age,
                    @RequestParam(name = "id")Integer id){
        R r = new R();
        r.setCode(200);
        r.setMsg("添加成功");
        return  r;
    }

    //编辑员工信息
    @RequestMapping(value = ("/updateEmp"),method = RequestMethod.POST)
    @ApiOperation(value = "编辑员工接口",notes = "修改员工信息",httpMethod = "post", response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "员工id",paramType = "query",dataType = "int",required = true),
            @ApiImplicitParam(name = "emp_name",value = "员工姓名",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "emp_sex",value = "性别",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "emp_age",value = "年龄",paramType = "query",dataType = "byte",required = false),
            @ApiImplicitParam(name = "office_id",value = "所在科室id",paramType = "query",dataType = "int",required = true),
            @ApiImplicitParam(name = "emp_grade",value = "员工级别",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "menu_id",value = "员工职务id",paramType = "query",dataType = "byte",required = true),
            @ApiImplicitParam(name = "photo",value = "头像路径",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "doctor_adept",value = "医生擅长",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "doctor_introduce",value = "医生介绍",paramType = "query",dataType = "String",required = false)
    })
    public R updateEmp(@RequestParam(name = "id")Integer id,
                       @RequestParam(name = "emp_name")String emp_name,
                       @RequestParam(name = "emp_sex") String emp_sex,
                       @RequestParam(name = "emp_age")Integer emp_age,
                       @RequestParam(name = "office_id") Integer offic_id,
                       @RequestParam(name = "emp_grade")String emp_grade,
                       @RequestParam(name = "menu_id")Integer menu_id,
                       @RequestParam(name = "photo")String photo,
                       @RequestParam(name = "doctor_adept")String doctor_adept,
                       @RequestParam(name = "doctor_introduce")String doctor_introduce){
        R r = new R();
        r.setCode(200);
        r.setMsg("修改成功");
        return  r;
    }

    //点击禁用按钮
    @RequestMapping(value = ("/stopEmpById"),method = RequestMethod.POST)
    @ApiOperation(value = "禁用员工接口",notes = "根据员工Id禁用员工信息",httpMethod = "post", response = R.class)
    @ApiImplicitParam(name = "id",value = "员工Id",required = true,dataType = "int",paramType = "query")
    public R stopEmpById(@RequestParam(name = "id")Integer id){
        R r = new R();
        r.setCode(200);
        r.setMsg("禁用成功");
        return  r;
    }

    //点击启用按钮
    @RequestMapping(value = ("/startEmpById"),method = RequestMethod.POST)
    @ApiOperation(value = "启用员工接口",notes = "根据员工Id启用员工",httpMethod = "post", response = R.class)
    @ApiImplicitParam(name = "id",value = "员工Id",required = true,dataType = "int",paramType = "query")
    public R startEmpById(@RequestParam(name = "id")Integer id){
        R r = new R();
        r.setCode(200);
        r.setMsg("启用成功");
        return r;
    }






}
